package com.ph.irp.base.accountbook.dao;

import org.springframework.context.ApplicationContext;

import com.ph.irp.BasicTest;
import com.ph.irp.base.accountbook.dao.PBaseAccountbookDAO;
import com.ph.irp.model.PBaseAccountbook;

public class TesAccountbookDAO extends BasicTest{
    
	private ApplicationContext application = null ;
	private PBaseAccountbookDAO accountbookDAO = null ;
	
	/**
	 * test select method
	 * @throws Throwable 
	 */
	public void testGetAllAccountbookDAO() throws Throwable{
		
		application = getContext(getConfigLocations());
		
		accountbookDAO = (PBaseAccountbookDAO) application.getBean("accountbookDAO") ;
		
//		System.out.println(accountbookDAO.getAccountbookById(new Integer(1)).getAccountbookCode());
		
		accountbookDAO.deleteAccountbookById(new Integer(22)) ;
		
//		assertNotNull(accountbook.getAllAccountbooks());
		
		
//		PBaseAccountbook pbaseAccountbook = new PBaseAccountbook() ;
//		
//		pbaseAccountbook.setAccountbookCode("989") ;
//		
//		pbaseAccountbook.setAccountbookName("固定资产") ;
//		
//		pbaseAccountbook.setAccountbookTypeId(1);
//		
//		pbaseAccountbook.setShortName("454152") ;
//		
//		accountbookDAO.addAccountbook(pbaseAccountbook) ;
	}
	/**
	 * test method updateAccountbook
	 * @throws Throwable 
	 */
	public void testUpdateAccountbook() throws Throwable{
		
		application = getContext(getConfigLocations());
		
		accountbookDAO = (PBaseAccountbookDAO) application.getBean("accountbookDAO") ;
		
		PBaseAccountbook pbaseAccountbook = new PBaseAccountbook() ;
		
		pbaseAccountbook.setAccountbookCode("11111") ;
		
		pbaseAccountbook.setAccountbookName("固定资产") ;
		
		pbaseAccountbook.setAccountbookId(19) ;
		
		pbaseAccountbook.setShortName("454152") ;
		
		pbaseAccountbook.setAccountbookTypeId(1);
		
		accountbookDAO.update(pbaseAccountbook) ;
		
	}
}
